﻿/**字符串格式化**/
String.format = function () {
    // The string containing the format items (e.g. "{0}")
    // will and always has to be the first argument.
    var theString = arguments[0];

    // start with the second argument (i = 1)
    for (var i = 1; i < arguments.length; i++) {
        // "gm" = RegEx options for Global search (more than one instance)
        // and for Multiline search
        var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm");
        theString = theString.replace(regEx, arguments[i]);
    }

    return theString;
}

/**前端错误输出**/
function printError(err) {
    if (err.responseJSON)
        $.messager.alert('错误提示', err.responseJSON.ExceptionMessage, "error");
    else
        $.messager.alert('错误提示', "状态提示 : "+err.statusText, "error");
}